﻿using System;
using System.Collections.Generic;
using System.Text;
using Barbar.Colonization.Core.Localization;
using System.Xml.Serialization;
using System.Runtime.Serialization;
using System.Collections.ObjectModel;

namespace Barbar.Colonization.Model.RuleSets {
  [XmlType(Namespace = Constants.XmlRootNamespace, TypeName = "BonusResourceType")]
  public class XmlBonusResourceType : XmlEntity, IBonusResourceType, IDeserializationCallback {
    private string m_NameCode;
    private TranslatorString m_Name;
    private Collection<XmlBonusType> m_BonusTypes = new Collection<XmlBonusType>();

    public Collection<XmlBonusType> BonusTypes {
      get { return m_BonusTypes; }
    }

    public string NameCode {
      get { return m_NameCode; }
      set { m_NameCode = value; }
    }

    #region IBonusResourceType Members

    TranslatorString IBonusResourceType.Name {
      get { return m_Name; }
    }

    IRawMaterialType IBonusResourceType.RawMaterialType {
      get { throw new NotImplementedException(); }
    }

    int IBonusResourceType.GetBonus(IRawMaterialType harvestedRawMaterialType, Tile tile) {
      throw new NotImplementedException();
    }

    #endregion

    #region IDeserializationCallback Members

    public void OnDeserialization(object sender) {
      m_Name = new TranslatorString(m_NameCode);
    }

    #endregion
  }
}
